<!DOCTYPE html>
<html>
<head>
    <title>划解交管二八分成</title>
    <#include "../inc/header.ftl"/>
    <link rel="stylesheet" href="${prefix}/assets/custom/css/main.css"/>
</head>
<body>

<div class="main-container ace-save-state" id="main-container">

    <div class="main-content">
        <div class="main-content-inner">

            <div class="page-content">
                <form id="illegalactivitydivideForm" name="illegalactivitydivideForm" action="illegalactivityDivideView"
                      method="post">
                    <table width="800" border="0" align="center" cellpadding="0" cellspacing="0" class="r_tablebr">
                        <tr>
                            <td valign="top" class="r_nr">
                                <table width="99%" border="0" cellpadding="0" cellspacing="0" class="r_zsdwbm">
                                    <tr>
                                        <td align="left"><b>划款单号</b>
                                            <input id="billnum" class="easyui-textbox" style="width:140px" value=""
                                                   style="width:190px;"/>&nbsp;&nbsp;
                                        <input type="button" name="searchbutton" id="searchbutton" onclick="queryIllegalactivitydivideData()" class="r_button" value="查询单据" /></td>
                                        <td>交易流水号<input type="text" id="bankaffirm" name="bankaffirm" value=""
                                                        class="r_input2" style="width:90px;"></td>
                                    </tr>
                                </table>
                                <table width="99%" border="0" cellspacing="0" cellpadding="0">
                                    <tr>
                                        <td class="r_title">河北省非税收入（交警罚没）分成划转单</td>
                                    </tr>
                                </table>
                                <table width="99%" border="1" cellpadding="0" cellspacing="0" class="r_zsdwbm">
                                    <tr>
                                        <td width="100" align="right">付款账户名称：</td>
                                        <td align="left"><input name="accountname" type="text" id="accountname"
                                                                style="width:200px" readonly="readonly"
                                                                class="r_input"/></td>
                                    </tr>
                                    <tr>
                                        <td align="right">付款账户：</td>
                                        <td align="left"><input name="accountcode" type="text" id="accountcode"
                                                                style="width:200px" readonly="readonly"
                                                                class="r_input"/></td>
                                    </tr>
                                    <tr>
                                        <td align="right">开户银行：</td>
                                        <td align="left"><input name="bankname" type="text" id="bankname"
                                                                style="width:200px" readonly="readonly"
                                                                class="r_input"/></td>
                                    </tr>
                                </table>
                                <table width="99%" border="1" cellpadding="0" cellspacing="1" class="r_jcxx4" id="tab">
                                    <tr>
                                        <td align="center" bgcolor="#f0f0f0">序号</td>
                                        <td align="center" bgcolor="#f0f0f0">行政区划编码</td>
                                        <td align="center" bgcolor="#f0f0f0">行政区划名称</td>
                                        <td width="140" align="center" bgcolor="#f0f0f0">账户名称</td>
                                        <td width="140" align="center" bgcolor="#f0f0f0">账户</td>
                                        <td align="center" bgcolor="#f0f0f0">开户银行</td>
                                        <td align="center" bgcolor="#f0f0f0">金额</td>
                                        <td align="center" bgcolor="#f0f0f0">操作</td>
                                    </tr>
                                    <tr id="tab-tr1">
                                        <td width="60" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="140" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="140" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"><input type="button"
                                                                                                name="paybutton1"
                                                                                                id="paybutton1"
                                                                                                class="r_button"
                                                                                                value="付款"/></td>
                                    </tr>
                                    <tr id="tab-tr2">
                                        <td width="60" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="140" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="140" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"><input type="button"
                                                                                                name="paybutton2"
                                                                                                id="paybutton2"
                                                                                                class="r_button"
                                                                                                value="付款"/></td>
                                    </tr>
                                    <tr id="tab-tr3">
                                        <td width="60" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="140" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="140" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"><input type="button"
                                                                                                name="paybutton3"
                                                                                                id="paybutton3"
                                                                                                class="r_button"
                                                                                                value="付款"/></td>
                                    </tr>
                                    <tr id="tab-tr4">
                                        <td width="60" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="140" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="140" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"><input type="button"
                                                                                                name="paybutton4"
                                                                                                id="paybutton4"
                                                                                                class="r_button"
                                                                                                value="付款"/></td>
                                    </tr>
                                    <tr id="tab-tr5">
                                        <td width="60" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="140" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="140" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"><input type="button"
                                                                                                name="paybutton5"
                                                                                                id="paybutton5"
                                                                                                class="r_button"
                                                                                                value="付款"/></td>
                                    </tr>
                                    <tr id="tab-tr6">
                                        <td width="60" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="140" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="140" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"></td>
                                        <td width="100" align="center" bgcolor="#f0f0f0"><input type="button"
                                                                                                name="paybutton6"
                                                                                                id="paybutton6"
                                                                                                class="r_button"
                                                                                                value="付款"/></td>
                                    </tr>
                                </table>
                                <table width="99%" border="1" cellpadding="0" cellspacing="1" class="r_jcxx4">
                                    <tr>
                                        <td align="center" bgcolor="#f0f0f0">笔　　数</td>
                                        <td align="left" bgcolor="#f0f0f0"><input name="countfunds" type="text"
                                                                                  id="countfunds" style="width:100px;"
                                                                                  readonly="readonly" class="r_input"/>
                                        </td>
                                        <td align="center" bgcolor="#f0f0f0">合　　计</td>
                                        <td colspan="3" align="center" bgcolor="#f0f0f0">
                                            <table width="100%" border="1" cellspacing="0" cellpadding="0">
                                                <tr>
                                                    <td width="50%" bgcolor="#FFFFFF">（大写）<span id="vbigfunds"></span>
                                                    </td>
                                                    <td width="50%" bgcolor="#FFFFFF">（小写）<span id="vfunds"></span></td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                                <table width="99%" border="1" cellspacing="0" cellpadding="0">
                                    <tr>

                                        <td height="40" align="right">
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>

                </form>
            </div><!-- /.page-content -->

        </div>
    </div><!-- /.main-content -->
</div><!-- /.main-container -->

<#include "../inc/basicjs.ftl"/>
<!-- basic scripts -->
<script src="${prefix}/assets/custom/js/commonview.js"></script>

<script type="text/javascript">
    //数据初始化
    var removeid = "";
    var rmDetailno = "";
    function pay(detailno,trid) {
        removeid = "#"+trid;
        rmDetailno =detailno;
        var billnum = $("#billnum").val();
        $.ajax({
            url: prefix +'/view/scalebill/IllegalactivityDividepayview',
            data: {detailno: detailno,billnum:billnum},
            type: "POST",
            success: function (data) {
                if(data.success) {
                    var delid="#"+trid;
                    $(removeid).remove();
                    iLength -= 1;
                    for(var p in records) {
                        if(records[p].detailno==rmDetailno) {
                            records[p].remove=1;
                            records[p].payed=1;
                            curNum = parseInt(p);
                            //添加新行
                            for(i=(curNum+1);(iLength>15 && i<records.length);i++) {
                                if(records[i].payed==0 && records[i].remove==0) {
                                    var trid="tab-tr"+(rownum+1);
                                    strhtml = "<tr id='tab-tr"+(rownum+1)+"'><td align='center' bgcolor='#f0f0f0' width='60px'>"+(records[i].detailno)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[i].cantoncode)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[i].cantonname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[i].accountname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[i].accountcode)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[i].bankname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[i].collectfund)+"</td><td align='center' bgcolor='#f0f0f0'><input type='button' name='paybutton"+(rownum+1)+"' id='paybutton"+(rownum+1)+"' onclick='pay(&quot;"+(records[i].detailno)+"&quot;,&quot;"+trid+"&quot;)' class='r_button' value='付款' /></td></tr>";
                                    $(strhtml).insertAfter($("#tab tr:eq(14)"));
                                    rownum++;
                                    records[i].remove=1;
                                    break;
                                }
                            }
                            //合计减去
                            fund=fund.del(records[p].collectfund);
                            $("#countfunds").val(iLength);
                            var vbigfunds=upDigit(fund);
                            $("#vfunds").html(fund);
                            $("#vbigfunds").html(vbigfunds);
                            return;
                        }
                    }
                }else{
                    alert(data.msg);
                }
            }
        });
    }
    //加法函数，用来得到精确的加法结果
    //说明:javascript的加法结果会有误差，在两个浮点数相加的时候会比较明显。这个函数返回较为精确的加法结果。
    //调用:accAdd(arg1,arg2)
    //返回值:arg1加上arg2的精确结果
    function accAdd(arg1,arg2)
    {
        var r1,r2,m;
        try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0}
        try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0}
        m=Math.pow(10,Math.max(r1,r2))
        return (arg1*m+arg2*m)/m;
    }

    //给Number类型增加一个add方法，调用起来更加方便。
    Number.prototype.add = function (arg)
    {
        return accAdd(arg,this);
    }
    //给Number类型增加一个del方法，调用起来更加方便。
    Number.prototype.del = function (arg)
    {
        return accAdd(this,-arg);
    }
    //record总长度
    var iLength = 0;
    //record记录
    var records = [];
    //页码
    var pageno = 1;
    //当前操作的行
    var curNum = -1;

    function fPage()
    {
        rownum = 0;
        if(pageno==1) return;
        pageno=1;
        var tLength = $("#tab tr").length;
        for(i=tLength-2;i>=1;i--)
        {
            $("#tab tr:eq("+i+")").remove();
        }
        for(var p in records)
        {
            if(records[p].payed==0)
            {
                records[p].remove=0;
            }
            else
            {
                records[p].remove=1;
            }
        }
        for(var p in records)
        {
            //添加新行
            if(records[p].payed==0 && rownum<15)
            {
                var trid="tab-tr"+(rownum+1);
                strhtml = "<tr id='tab-tr"+(rownum+1)+"'><td align='center' bgcolor='#f0f0f0' width='60px'>"+(records[p].detailno)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].cantoncode)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].cantonname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].accountname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[i].accountcode)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].bankname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].collectfund)+"</td><td align='center' bgcolor='#f0f0f0'><input type='button' name='paybutton"+(rownum+1)+"' id='paybutton"+(rownum+1)+"' onclick='pay(&quot;"+(records[p].detailno)+"&quot;,&quot;"+trid+"&quot;)' class='r_button' value='付款' /></td></tr>";
                $(strhtml).insertAfter($("#tab tr:eq("+rownum+")"));
                rownum++;
                records[p].remove=1;
            }
        }
    }
//首页
    function fPage()
    {
        rownum = 0;
        if(pageno==1) return;
        pageno=1;
        var tLength = $("#tab tr").length;
        for(i=tLength-2;i>=1;i--)
        {
            $("#tab tr:eq("+i+")").remove();
        }
        for(var p in records)
        {
            if(records[p].payed==0)
            {
                records[p].remove=0;
            }
            else
            {
                records[p].remove=1;
            }
        }
        for(var p in records)
        {
            //添加新行
            if(records[p].payed==0 && rownum<15)
            {
                var trid="tab-tr"+(rownum+1);
                strhtml = "<tr id='tab-tr"+(rownum+1)+"'><td align='center' bgcolor='#f0f0f0' width='60px'>"+(records[p].detailno)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].cantoncode)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].cantonname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].accountname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[i].accountcode)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].bankname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].collectfund)+"</td><td align='center' bgcolor='#f0f0f0'><input type='button' name='paybutton"+(rownum+1)+"' id='paybutton"+(rownum+1)+"' onclick='pay(&quot;"+(records[p].detailno)+"&quot;,&quot;"+trid+"&quot;)' class='r_button' value='付款' /></td></tr>";
                $(strhtml).insertAfter($("#tab tr:eq("+rownum+")"));
                rownum++;
                records[p].remove=1;
            }
        }
    }

//上一页
    function ePage()
    {
        rownum = 0;
        var ms = parseInt(parseInt(iLength)/15);
        var ys = parseInt(iLength)-parseInt(ms)*15;
        for(var p in records)
        {
            if(records[p].payed==0)
            {
                records[p].remove=0;
            }
            else
            {
                records[p].remove=1;
            }
        }
        var tLength = $("#tab tr").length;
        for(i=tLength-2;i>=1;i--)
        {
            $("#tab tr:eq("+i+")").remove();
        }
        if(ys==0)
        {
            pageno=parseInt(ms);
            curNum = 15*(parseInt(ms)-1);
            var dCount = 0;
            for(var p in records)
            {
                if(records[p].payed==0)
                {
                    if(dCount>=curNum)
                    {
                        //添加新行
                        var trid="tab-tr"+(rownum+1);
                        strhtml = "<tr id='tab-tr"+(rownum+1)+"'><td align='center' bgcolor='#f0f0f0' width='60px'>"+(records[p].detailno)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].cantoncode)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].cantonname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].accountname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[i].accountcode)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].bankname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].collectfund)+"</td><td align='center' bgcolor='#f0f0f0'><input type='button' name='paybutton"+(rownum+1)+"' id='paybutton"+(rownum+1)+"' onclick='pay(&quot;"+(records[p].detailno)+"&quot;,&quot;"+trid+"&quot;)' class='r_button' value='付款' /></td></tr>";
                        $(strhtml).insertAfter($("#tab tr:eq("+rownum+")"));
                        rownum++;
                        records[p].remove=1;
                    }
                    dCount++;
                    if(rownum>=15) break;
                }
            }
        }
        else
        {
            pageno=parseInt(ms)+1;
            curNum = parseInt(iLength)-parseInt(ys);
            var dCount = 0;
            for(var p in records)
            {
                if(records[p].payed==0)
                {
                    if(dCount>=curNum)
                    {
                        //添加新行
                        var trid="tab-tr"+(rownum+1);
                        strhtml = "<tr id='tab-tr"+(rownum+1)+"'><td align='center' bgcolor='#f0f0f0' width='60px'>"+(records[p].detailno)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].cantoncode)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].cantonname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].accountname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[i].accountcode)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].bankname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].collectfund)+"</td><td align='center' bgcolor='#f0f0f0'><input type='button' name='paybutton"+(rownum+1)+"' id='paybutton"+(rownum+1)+"' onclick='pay(&quot;"+(records[p].detailno)+"&quot;,&quot;"+trid+"&quot;)' class='r_button' value='付款' /></td></tr>";
                        $(strhtml).insertAfter($("#tab tr:eq("+rownum+")"));
                        rownum++;
                        records[p].remove=1;
                    }
                    dCount++;
                    if(rownum>=15) break;
                }
            }
        }
    }
//下一页
    function pPage() {
        if(pageno==1) return;
        if(parseInt(pageno-1)==1)
        {
            fPage();
            return;
        }
        pageno -=1;
        rownum = 0;
        for(var p in records) {
            if(records[p].payed==0){
                records[p].remove=0;
            }
            else {
                records[p].remove=1;
            }
        }
        var tLength = $("#tab tr").length;
        for(i=tLength-2;i>=1;i--)
        {
            $("#tab tr:eq("+i+")").remove();
        }
        curNum = 15*(parseInt(pageno)-1);
        var dCount = 0;
        for(var p in records)
        {
            if(records[p].payed==0)
            {
                if(dCount>=curNum)
                {
                    //添加新行
                    var trid="tab-tr"+(rownum+1);
                    strhtml = "<tr id='tab-tr"+(rownum+1)+"'><td align='center' bgcolor='#f0f0f0' width='60px'>"+(records[p].detailno)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].cantoncode)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].cantonname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].accountname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[i].accountcode)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].bankname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].collectfund)+"</td><td align='center' bgcolor='#f0f0f0'><input type='button' name='paybutton"+(rownum+1)+"' id='paybutton"+(rownum+1)+"' onclick='pay(&quot;"+(records[p].detailno)+"&quot;,&quot;"+trid+"&quot;)' class='r_button' value='付款' /></td></tr>";
                    $(strhtml).insertAfter($("#tab tr:eq("+rownum+")"));
                    rownum++;
                    records[p].remove=1;
                }
                dCount++;
                if(rownum>=15) break;
            }
        }
    }


    //尾页
    function nPage()
    {
        var ms = parseInt(parseInt(iLength)/15);
        var ys = parseInt(iLength)-parseInt(ms)*15;
        if(ys==0)
        {
            if(parseInt(pageno)==ms) return;
            if(parseInt(pageno+1)==ms)
            {
                ePage();
                return;
            }
        }
        else
        {
            if(parseInt(pageno+1)==ms+1)
            {
                ePage();
                return;
            }
        }
        rownum = 0;
        for(var p in records)
        {
            if(records[p].payed==0)
            {
                records[p].remove=0;
            }
            else
            {
                records[p].remove=1;
            }
        }
        var tLength = $("#tab tr").length;
        for(i=tLength-2;i>=1;i--)
        {
            $("#tab tr:eq("+i+")").remove();
        }
        curNum = 15*(parseInt(pageno));
        var dCount = 0;
        for(var p in records)
        {
            if(records[p].payed==0)
            {
                if(dCount>=curNum)
                {
                    //添加新行
                    var trid="tab-tr"+(rownum+1);
                    strhtml = "<tr id='tab-tr"+(rownum+1)+"'><td align='center' bgcolor='#f0f0f0' width='60px'>"+(records[p].detailno)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].cantoncode)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].cantonname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].accountname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[i].accountcode)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].bankname)+"</td><td align='center' bgcolor='#f0f0f0'>"+(records[p].collectfund)+"</td><td align='center' bgcolor='#f0f0f0'><input type='button' name='paybutton"+(rownum+1)+"' id='paybutton"+(rownum+1)+"' onclick='pay(&quot;"+(records[p].detailno)+"&quot;,&quot;"+trid+"&quot;)' class='r_button' value='付款' /></td></tr>";
                    $(strhtml).insertAfter($("#tab tr:eq("+rownum+")"));
                    rownum++;
                    records[p].remove=1;
                }
                dCount++;
                if(rownum>=15) break;
            }
        }
        pageno +=1;
    }
var rownum = 0;
var fund=Number("0");
var strhtml = "";

    function queryIllegalactivitydivideData() {
        var state = [{"key":"0","value":"查询错误"},{"key":"1","value":"正常"},{"key":"2","value":"票据已用"},{"key":"3","value":"票据已核销"},{"key":"4","value":"票据不存在或已缴费"},{"key":"5","value":"对账不成功，账户停用"}];
        var billnum = $("#billnum").val();
        if(billnum=="")
        {
            alert("请输入划款单号！");
            $("#billnum").focus();
            return;
        }
        if(billnum.indexOf("FCIA")!=0 || billnum.length!=14)
        {
            alert("请输入正确的划款单号！");
            $("#billnum").focus();
            return;
        }
        $.ajax({
            type: "POST",
            url:prefix+ '/view/scalebill/queryScaleBillView',
            dataType: "json",
            data: { billnum: billnum},
            success: function (dataOne) {
                var data =new DOMParser().parseFromString(dataOne.data, "text/xml")

                $(data).find("bill").each(function(i) {
                    //查找所有节点并遍历
                    $("#billnum").val($(this).children("billnum").text());
                    $("#accountname").val($(this).children("accountname").text());
                    $("#accountcode").val($(this).children("accountcode").text());
                    $("#bankname").val($(this).children("bankname").text());

                    var billstate = $(this).children("billstate").text();
                    if(billstate!='1')
                    {
                        for(var p in state)
                        {
                            if(state[p].key==billstate)
                            {
                                alert(state[p].value);
                            }
                        }
                        return;
                    }
                });
                var details_length = $(data).find("detail").length;
                iLength = details_length;
                //alert(details_length);
                if(details_length>0)
                {
                    var tLength = $("#tab tr").length;
                    for(i=tLength-1;i>=1;i--)
                    {
                        $("#tab tr:eq("+i+")").remove();
                    }
                    rownum=0;

                    records=[];
                    pageno=1;
                    fund=Number("0");
                    var $tr = $("#tab tr:last");
                    $(data).find("bill").find("details").find("detail").each(function(index, ele) {
                        var collectfund=Number($(ele).find("collectfund").text());
                        fund=fund.add(collectfund);
                        var detailno = $(ele).find("detailno").text();
                        var cantoncode = $(ele).find("cantoncode").text();
                        var cantonname = $(ele).find("cantonname").text();
                        var accountname = $(ele).find("accountname").text();
                        var accountcode = $(ele).find("accountcode").text();
                        var bankname = $(ele).find("bankname").text();
                        var trid="tab-tr"+(rownum+1);
                        if(rownum<15)
                        {
                            var record = {"remove":1,"payed":0,"detailno":detailno,"cantoncode":cantoncode,"cantonname":cantonname,"accountname":accountname,"accountcode":accountcode,"bankname":bankname,"collectfund":collectfund};
                            records.push(record);
                            var tTr = "<tr id='tab-tr"+(rownum+1)+"'><td align='center' bgcolor='#f0f0f0' width='60px'>"+(detailno)+"</td><td align='center' bgcolor='#f0f0f0'>"+cantoncode+"</td><td align='center' bgcolor='#f0f0f0'>"+cantonname+"</td><td align='center' bgcolor='#f0f0f0'>"+accountname+"</td><td align='center' bgcolor='#f0f0f0'>"+accountcode+"</td><td align='center' bgcolor='#f0f0f0'>"+bankname+"</td><td align='center' bgcolor='#f0f0f0'>"+collectfund+"</td><td align='center' bgcolor='#f0f0f0'><input type='button' name='paybutton"+(rownum+1)+"' id='paybutton"+(rownum+1)+"' onclick='pay(&quot;"+detailno+"&quot;,&quot;"+trid+"&quot;)' class='r_button' value='付款' /></td></tr>";
                            $tr.after(tTr);
                            $tr = $("#tab tr:last");
                            rownum++;
                        }
                        else
                        {
                            var record = {"remove":0,"payed":0,"detailno":detailno,"cantoncode":cantoncode,"cantonname":cantonname,"accountname":accountname,"accountcode":accountcode,"bankname":bankname,"collectfund":collectfund};
                            records.push(record);
                        }
                    });
                    strhtml = '<tr id="tab-tr6">'+
                        '<td width="100%" align="right" bgcolor="#f0f0f0" colspan="8">'+
                        '	<a href="javascript:void(0);" onclick="fPage()">首页</a>&nbsp;&nbsp;&nbsp;&nbsp;'+
                        '	<a href="javascript:void(0);" onclick="pPage()">上一页</a>&nbsp;&nbsp;&nbsp;&nbsp;'+
                        '	<a href="javascript:void(0);" onclick="nPage()">下一页</a>&nbsp;&nbsp;&nbsp;&nbsp;'+
                        '	<a href="javascript:void(0);" onclick="ePage()">尾页</a>&nbsp;&nbsp;&nbsp;&nbsp;</td>'+
                        '</tr>';
                    $tr = $("#tab tr:last");
                    $tr.after(strhtml);
                    $("#countfunds").val(details_length);
                    var vbigfunds=upDigit(fund);
                    $("#vfunds").html(fund);
                    $("#vbigfunds").html(vbigfunds);
                }
            }
        });
    }
</script>

</body>
</html>